package com.ai.deepseekspring.controller;




import com.ai.deepseekspring.Result.R;
import com.ai.deepseekspring.domain.dto.UserDTO;

import com.ai.deepseekspring.domain.dto.UserRegisterDTO;
import com.ai.deepseekspring.domain.vo.UserVO;
import com.ai.deepseekspring.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 用户登录接口
     *
     * @return 登录结果（包含用户信息和令牌）
     */
    @PostMapping("/login")
    public UserVO login(@RequestBody UserDTO userDTO) {
        return userService.login(userDTO);

    }

    /**
     * 用户注册接口
     *
     * @return 注册结果
     */
    @PostMapping("/register")
    public R register(@RequestBody UserRegisterDTO userRegisterDTO) {

        return userService.register(userRegisterDTO);
    }
}
